from .models import HomeFirstCategoryModel,HomeSecondCategoryModel,HomeThirdCategoryModel
from rest_framework import serializers




class GetHomeThirdCategorySerializer(serializers.ModelSerializer):
    second_id = serializers.CharField(source='home_second_category.id')
    class Meta:
        model = HomeThirdCategoryModel
        fields = ['name','id','second_id']





class GetHomeSecondCategorySerializer(serializers.ModelSerializer):
    first_id = serializers.CharField(source='home_first_category.id')
    home_third_category_home_second_category = GetHomeThirdCategorySerializer(many=True,read_only=True)


    class Meta:
        model = HomeSecondCategoryModel
        fields = ["name","id", "first_id",'home_third_category_home_second_category']